package cn.itcast.util;

import cn.itcast.bean.CleanBean;

import java.math.BigDecimal;

/**
 * 行情数据过滤工具类
 */
public class QuotUtil {

    //时间过滤> (9:30 - 15:00)
    public static boolean checkTime(CleanBean value) {
        return value.getEventTime() > SpecialTimeUtil.openTime && value.getEventTime() < SpecialTimeUtil.closeTime;
    }

    //数据过滤 >(高开低收 != 0)
    public static boolean checkData(CleanBean value) {
        return !value.getHighPrice().equals(BigDecimal.ZERO) && !value.getOpenPrice().equals(BigDecimal.ZERO)
                && !value.getLowPrice().equals(BigDecimal.ZERO) && !value.getPreClosePrice().equals(BigDecimal.ZERO);
    }

    //过滤沪深两市的股票数据
    public static boolean isStock(CleanBean value) {
        return value.getMdStreamId().equals("010") || value.getMdStreamId().equals("MD002");
    }

    //过滤沪深两市的指数数据
    public static boolean isIndex(CleanBean value) {
        return value.getMdStreamId().equals("900") || value.getMdStreamId().equals("MD001");
    }
}
